import { createBrowserRouter } from 'react-router-dom';
import Layout from '../components/Layout';
import { Home, About, Dashboard, DataExtractor, HotSearch, Category } from '../pages';
import type { RouteConfig } from './types';

/**
 * 应用路由配置
 * 使用React Router v6的嵌套路由结构
 */
export const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        index: true,
        element: <Home />,
        handle: {
          title: '首页'
        }
      },
      {
        path: 'dashboard',
        element: <Dashboard />,
        handle: {
          title: '仪表盘'
        }
      },
      {
        path: 'data-extractor',
        element: <DataExtractor />,
        handle: {
          title: '数据提取'
        }
      },
      {
        path: 'hot-search',
        element: <HotSearch />,
        handle: {
          title: '热搜表格'
        }
      },
      {
        path: 'category',
        element: <Category />,
        handle: {
          title: '服装类目'
        }
      },
      {
        path: 'about',
        element: <About />,
        handle: {
          title: '关于'
        }
      }
    ]
  }
]);